﻿using System.Xml;
using System.Xml.Serialization;

namespace WJ.Infrastructure.WeChat.Model.Pay
{
    /// <summary>
    /// 支付回调参数
    /// </summary>
    [XmlRoot("xml", Namespace = "")]
    public class NotifyParam
    {
        /// <summary>
        /// 返回状态码 SUCCESS/FAIL 此字段是通信标识，非交易标识，交易是否成功需要查看result_code来判断
        /// </summary>
        public string return_code { get; set; }

        /// <summary>
        /// 返回信息 返回信息，如非空，为错误原因签名失败参数格式校验错误
        /// </summary>
        public string return_msg { get; set; }

        //以下字段在return_code为SUCCESS的时候有返回

        public string appid { get; set; }

        public string mch_id { get; set; }

        public string device_info { get; set; }

        public string nonce_str { get; set; }

        public string sign { get; set; }

        public string sign_type { get; set; }

        /// <summary>
        /// 业务结果 SUCCESS/FAIL
        /// </summary>
        public string result_code { get; set; }

        /// <summary>
        /// 错误代码
        /// </summary>
        public string err_code { get; set; }

        /// <summary>
        /// 错误代码描述
        /// </summary>
        public string err_code_des { get; set; }

        /// <summary>
        /// 用户标识
        /// </summary>
        public string openid { get; set; }

        /// <summary>
        /// 是否关注公众账号
        /// </summary>
        public string is_subscribe { get; set; }

        /// <summary>
        /// 交易类型
        /// </summary>
        public string trade_type { get; set; }

        /// <summary>
        /// 付款银行
        /// </summary>
        public string bank_type { get; set; }

        /// <summary>
        /// 订单金额
        /// </summary>
        public string total_fee { get; set; }

        /// <summary>
        /// 应结订单金额 应结订单金额=订单金额-非充值代金券金额，应结订单金额<=订单金额。
        /// </summary>
        public string settlement_total_fee { get; set; }

        /// <summary>
        /// 货币种类
        /// </summary>
        public string fee_type { get; set; }

        /// <summary>
        /// 现金支付金额
        /// </summary>
        public string cash_fee { get; set; }

        /// <summary>
        /// 现金支付货币类型
        /// </summary>
        public string cash_fee_type { get; set; }

        /// <summary>
        /// 代金券金额
        /// </summary>
        public string coupon_fee { get; set; }

        /// <summary>
        /// 代金券使用数量
        /// </summary>
        public string coupon_count { get; set; }

        /// <summary>
        /// 代金券类型
        /// </summary>
        [XmlElement("coupon_type_$n")]
        public string coupon_type_n { get; set; }
        
        /// <summary>
        /// 代金券ID
        /// </summary>
        [XmlElement("coupon_id_$n")]
        public string coupon_id_n { get; set; }
        
        /// <summary>
        /// 单个代金券支付金额
        /// </summary>
        [XmlElement("coupon_fee_$n")]
        public string coupon_fee_n { get; set; }
        
        /// <summary>
        /// 微信支付订单号
        /// </summary>
        public string transaction_id { get; set; }
        
        /// <summary>
        /// 商户订单号
        /// </summary>
        public string out_trade_no { get; set; }
        
        /// <summary>
        /// 商家数据包
        /// </summary>
        public string attach { get; set; }
        
        /// <summary>
        /// 支付完成时间 支付完成时间，格式为yyyyMMddHHmmss，如2009年12月25日9点10分10秒表示为20091225091010
        /// </summary>
        public string time_end { get; set; }
    }
}